= form_for(@config, remote: true) do |f|
  - if @config.errors.any?
    #error_explanation
      %h2
        = pluralize(@config.errors.count, "error")
        prohibited this config from being saved:
      %ul
        - @config.errors.full_messages.each do |message|
          %li= message
  .field
    -#= f.label :content
    %br/
    = f.hidden_field :content
  .actions.hidden
    = f.submit

%div{style:"width:100%;"}
  %script#container{name:"content", type:"text/plain", style:"width:98%;"}
    填写内容
%br/
%button#submit-config.btn.btn-primary 保存
%span#config-updated-icon{style:'font-size: 22px;color: #3c763d;display: none;'}
  已保存
  %i.glyphicon.glyphicon-ok{style:'font-size: 22px;color: #3c763d;display: none;'}

= stylesheet_link_tag "//ueditor.baidu.com/umeditor/themes/default/css/umeditor.min.css"
= javascript_include_tag "//ueditor.baidu.com/umeditor/umeditor.min.js"
= javascript_include_tag "//ueditor.baidu.com/umeditor/umeditor.config.js"
= javascript_include_tag "//ueditor.baidu.com/umeditor/lang/zh-cn/zh-cn.js"
= javascript_include_tag "//ueditor.baidu.com/umeditor/dialogs/link/link.js"
= javascript_include_tag "//ueditor.baidu.com/umeditor/dialogs/image/image.js"
= javascript_include_tag "//ueditor.baidu.com/umeditor/dialogs/video/video.js"
= javascript_include_tag "//ueditor.baidu.com/umeditor/dialogs/map/map.js"
= javascript_include_tag "//ueditor.baidu.com/umeditor/dialogs/formula/formula.js"
= javascript_include_tag "//ueditor.baidu.com/umeditor/dialogs/emotion/emotion.js"

:javascript
  var um = UM.getEditor('container', {
    autoHeight: false
  });

  um.ready(function() {
    um.setHeight(400);
  });

  $("#submit-config").click(function(){
    um.ready(function() {
      //获取html内容，返回: <p>hello</p>
      var html = um.getContent();
      $("#config_content").val(html);
    });
    $(".edit_config").submit();
  });
- if @config.content
  :javascript
    um.ready(function() {
      #{
        "um.setContent(\"#{@config.str_safe }\")"
      }
    });